package cn.tedu.spring.eg3;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@Controller
public class ShopController {
    private String name;
    public ShopController() {
        System.out.println("1.实例化阶段");
    }
    @Value("张三")
    public void setName(String name) {
        this.name = name;
        System.out.println("2.赋值阶段");
    }
    @PostConstruct
    public void init(){
        System.out.println("3.初始化阶段");
    }
    @PreDestroy
    public void destory(){
        System.out.println("5.销毁阶段");
    }

    @Override
    public String toString() {
        return "ShopController{" +
                "name='" + name + '\'' +
                '}';
    }
}
